<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // class 是一个语法糖 也就是类 相当于构造函数
        // class 声明类的关键字 后面紧跟的是声明的类名

        // function Game() {
        //     this.gameName = "王者荣耀"
        // }
        // // console.log(Game.prototype)
        // Game.prototype.say = function() {
            
        // }
        // // var game = new Game()

        // function Role() {

        // }

        // Role.prototype = new Game()

        // Role.prototype.constructor = Role

        // console.log(Role.prototype)
        
        
        class Game {
            constructor(gameName) {
                // console.log('hello world')
                this.gameName = gameName
            }


            say() {
                console.log('欢迎进入王者荣耀')
            }
        }

        Game.prototype.run = function() {
            
        }
        class Role extends Game {
            constructor(roleName, gameName) {
                super(gameName)
                this.roleName = roleName
            }
            
            dance() {
                // console.log('开始跳舞')
                // this.roleName = "小卤蛋"
            }


            short() {

            }
        }
        console.log(Role.prototype)
        // var game = new Game() // class 类 new关键字实例化时调用的是constructor函数
        var role = new Role('鲁班大师', '王者荣耀')
        // role.say()
        console.log(role)

    </script>
</body>
</html>